package WorkWithFile;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Reader;
import java.util.*;
public class ReadFile {

    private Reader r;
	/**
     * @param args the command line arguments
     */
    public ReadFile(String filename)throws IOException{
        FileInputStream file=new FileInputStream(filename);
        r = new java.io.InputStreamReader(file,"UTF-8");
        try{
            BufferedReader br=new BufferedReader(r);
            String s=null;
            StringBuilder line=new StringBuilder();
           while((s=br.readLine())!=null){
              line.append(s).append("\n");
           }
            System.out.println("Noi dung file!!!");
            System.out.println(line);
        }
        catch(Exception e){
            System.out.println("Khong doc duoc file!!!!");
        }
        return;
    }
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        Scanner input=new Scanner(System.in);
        System.out.println("Nhap vao ten file: ");
        String file=input.nextLine();
        ReadFile(file);
    }
	private static void ReadFile(String file) {
		// TODO Auto-generated method stub
		
	}
}
